﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Catalog.API.Migrations
{
    public partial class CatalogInit : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateSequence(
                name: "expressstoreseq",
                incrementBy: 10);

            migrationBuilder.CreateSequence(
                name: "expresstypeseq",
                incrementBy: 10);

            migrationBuilder.CreateSequence(
                name: "productseq",
                incrementBy: 10);

            migrationBuilder.CreateSequence(
                name: "residentialareasseq",
                incrementBy: 10);

            migrationBuilder.CreateTable(
                name: "expressstore",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false),
                    ExpressStoreCode = table.Column<string>(nullable: false),
                    Name = table.Column<string>(nullable: false),
                    Phone = table.Column<string>(nullable: true),
                    OwnerId = table.Column<string>(nullable: true),
                    ContactMan = table.Column<string>(nullable: true),
                    CreateUserId = table.Column<string>(nullable: false),
                    ModifyUserId = table.Column<string>(nullable: true),
                    CreateTime = table.Column<DateTime>(nullable: false),
                    UpdateTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_expressstore", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "expresstype",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false),
                    Name = table.Column<string>(nullable: false),
                    CreateUserId = table.Column<string>(nullable: false),
                    Phone = table.Column<string>(nullable: true),
                    CreateTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_expresstype", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "product",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false),
                    ProductCode = table.Column<string>(nullable: false),
                    ProductType = table.Column<int>(nullable: false),
                    Name = table.Column<string>(nullable: false),
                    Description = table.Column<string>(nullable: true),
                    Remark = table.Column<string>(nullable: true),
                    Size = table.Column<int>(nullable: false),
                    CreateTime = table.Column<DateTime>(nullable: false),
                    CreateUserId = table.Column<string>(nullable: false),
                    ModifyTime = table.Column<DateTime>(nullable: true),
                    ModifyUserId = table.Column<DateTime>(nullable: true),
                    Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_product", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "residentialareas",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false),
                    ResidentialAreasCode = table.Column<string>(nullable: false),
                    Name = table.Column<string>(nullable: false),
                    AgentManId = table.Column<string>(nullable: false),
                    CreateTime = table.Column<DateTime>(nullable: false),
                    CreateUserId = table.Column<string>(nullable: false),
                    ModifyUserId = table.Column<string>(nullable: true),
                    ModifyTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_residentialareas", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "expressstore");

            migrationBuilder.DropTable(
                name: "expresstype");

            migrationBuilder.DropTable(
                name: "product");

            migrationBuilder.DropTable(
                name: "residentialareas");

            migrationBuilder.DropSequence(
                name: "expressstoreseq");

            migrationBuilder.DropSequence(
                name: "expresstypeseq");

            migrationBuilder.DropSequence(
                name: "productseq");

            migrationBuilder.DropSequence(
                name: "residentialareasseq");
        }
    }
}
